package com.haitaoit.chengquan.module.login;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.haitaoit.chengquan.R;
import com.haitaoit.chengquan.base.BaseActivity;
import com.haitaoit.chengquan.module.login.enterprise.RegistEnterpriseActivity;
import com.haitaoit.chengquan.module.login.person.RegistPersonalActivity;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.lidroid.xutils.view.annotation.event.OnClick;

public class RegistSelectActivity extends BaseActivity {
    @ViewInject(R.id.regist_geren)
    TextView regist_geren;
    @ViewInject(R.id.regist_qiye)
    TextView regist_qiye;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_regist_select);
        ViewUtils.inject(this);
        regist_geren.setVisibility(View.GONE);
        regist_qiye.setVisibility(View.GONE);

//        // 广播 需求注册成功
//        IntentFilter mFilter = new IntentFilter();
//        mFilter.addAction("register_succ_xiuqiu");
//        registerReceiver(mReceiver, mFilter);
//
//        // 广播 个人注册成功
//        IntentFilter mFilter1 = new IntentFilter();
//        mFilter1.addAction("register_succ_geren");
//        registerReceiver(mReceiver, mFilter1);
//
//        // 广播 企业注册成功
//        IntentFilter mFilter2 = new IntentFilter();
//        mFilter2.addAction("register_succ_qiye");
//        registerReceiver(mReceiver, mFilter2);
//    }
//
//    private BroadcastReceiver mReceiver = new BroadcastReceiver() {
//        @Override
//        public void onReceive(Context context, Intent intent) {
//            finish();
//        }
    }

//    @Override
//    protected void onDestroy() {
//        super.onDestroy();
//        unregisterReceiver(mReceiver);
//    }

    @OnClick({R.id.left, R.id.regist_xuqiu, R.id.regist_fuwu, R.id.regist_geren, R.id.regist_qiye})
    public void onClick(View v) {
        Intent intent = new Intent();
        switch (v.getId()) {
            case R.id.left:
                finish();
                break;
            case R.id.regist_xuqiu:// 需求商
                regist_geren.setVisibility(View.GONE);
                regist_qiye.setVisibility(View.GONE);

                intent.setClass(RegistSelectActivity.this, RegistNeedActivity.class);
                startActivity(intent);
                break;
            case R.id.regist_fuwu:// 服务商
                regist_geren.setVisibility(View.VISIBLE);
                regist_qiye.setVisibility(View.VISIBLE);
                break;
            case R.id.regist_geren:// 个人服务商
                intent.setClass(RegistSelectActivity.this, RegistPersonalActivity.class);
                startActivity(intent);
                break;
            case R.id.regist_qiye:// 企业
                intent.setClass(RegistSelectActivity.this, RegistEnterpriseActivity.class);
                startActivity(intent);
                break;
        }
    }
}
